package com.example.xianji.adapter;

import java.util.ArrayList;

import android.content.Context;

import android.support.v4.view.PagerAdapter;

import android.view.View;

import android.view.ViewGroup;
import android.widget.ImageView;

public class ViewPagerAdapter extends PagerAdapter{
	private ArrayList<ImageView> list;
	private Context context;

	public ViewPagerAdapter(ArrayList<ImageView> list, Context context) {
		super();
		this.list = list;
		this.context = context;
	}

	@Override
	public int getCount() {
		return list.size();
	}

	@Override
	public boolean isViewFromObject(View arg0, Object arg1) {
		return arg0 == arg1;
	}

	@Override
	public Object instantiateItem(ViewGroup container, int position) {
		container.addView(list.get(position));
		return list.get(position);
	}

	@Override
	public void destroyItem(ViewGroup container, int position, Object object) {
		container.removeView((View) object);
	}
}
